#!/usr/bin/perl -w

use 5.010;

sub divisors {
my $number = shift;
my @divisors = ();
foreach my $divisor ( 2 .. $number/2 ) {

   if ( ${number}%${divisor} == 0 ) {
    push @divisors, $divisor;
   }
 }
return @divisors;
}

say "Enter a number";
chomp ($hum = <STDIN>);

given ( $hum ) {
 when ( $_ ~~ /\d/ ) {
 @array = &divisors ($hum);
 say "divisors is @array";
 }
 when ( $hum ~~ /^$/ ) {
 say "You don't enter a number";
 }
 default { say "$hum is not a number"; }
}
